<template>
	<z-paging ref="paging" :refresher-end-bounce-enabled="false" :refresher-complete-duration="300" :refresher-complete-delay="500"
	v-model="dataList"
	@query="queryList"
	:auto="false"
	:default-page-size="15"
	loading-more-no-more-text="已经到底线了">
	    <view class="likeHistory_content">
			<view class="box" v-for="(item, index) in dataList" :key="index" @click="clickToItem(item)">
			    <view class="box_imgInfo">
			    	<view class="box_imgInfo_img">
			    		<image class="image" :src="item.cover" mode="aspectFill"></image>
			    	</view>
			    	<view class="box_imgInfo_playIcon">
			    		<image class="image" src="/static/video/video-pause.png" mode=""></image>
			    	</view>
					<view class="box_imgInfo_playNumber">
						{{ item.playlet_number_name }}
					</view>
			    </view>
			    <view class="box_titleT">{{ item.playlet_name }}</view>
			</view>
	    </view>
	</z-paging>
</template>

<script>
	let that;
	import interfaces from "@/utils/interfaces.js"
	import config from "@/utils/config.js"
	import tools from '@/utils/tools.js'
	
	export default {
		components: {
		},
		data() {
			return {
				dataList:[]
			}
		},
		mounted() {
			that = this;
		},
		onShow() {
			if(this.$refs.paging){
				this.$refs.paging.reload();
			}else{
				setTimeout(()=>{
					that.$refs.paging.reload();
				},500)
			}
		},
		methods: {
			refreshLikeFn(){
				this.$refs.paging.reload();
			},
			queryList(pageNum, pageSize) {
				// console.log(pageNum, pageSize)
				let self = this;
				self.request({
					url: interfaces.user_likeHistory_list,
					data:{"page": pageNum},
					method:"POST",
					success: (res)=>{
						// console.log("点赞历史",res)						
						if (pageNum == 1) {
							self.dataList = []
						}
						self.$refs.paging.complete(res.content)
						self.dataList = self.dataList.concat(res.content)
					},
					fail:(e) => {
						self.$refs.paging.complete(false)
					}
				});
			},
			clickToItem(res){
				let data = {playlet_id:res.playlet_id,
				            name:res.playlet_name, 
							playlet_number: res.playlet_number,
					        last_episode_number:res.last_episode_number}
				tools.jump_video_page_by_info(data)
			}
		}
	}
</script>

<style lang="scss">
	.likeHistory_content{
		display: flex;
		box-sizing: border-box;
		flex-direction: row;
		flex-wrap: wrap;
		padding: 5px;
		margin: 5px 0px;
		justify-content: left;
		
		.box{
			display: flex;
			box-sizing: border-box;
			flex-direction: column;
			width: 33.33%;
			padding: 5px;
			margin-top: 10px;
			// background-color: red;
			
			.box_imgInfo{
				display: flex;
				position: relative;
				justify-content: center;
				align-items: center;
				width: 100%;
				height: 300rpx;
				.box_imgInfo_img{
					display: flex;
					position: absolute;
					width: 100%;
					height: 100%;
					.image{
						width: 100%;
						height: 100%;
						border-radius: 15px;
						// background-color: greenyellow;
					}
				}
				.box_imgInfo_playIcon{
					display: flex;
					position: absolute;
					flex-shrink: 0;
					width: 80rpx;
					height: 80rpx;
					.image{
						width: 100%;
						height: 100%;
					}
				}
				.box_imgInfo_playNumber{
					position: absolute;
					left: 0;
					bottom: 0;
					width: 100%;
					height: 50rpx;
					line-height: 50rpx;
					border-bottom-left-radius: 15rpx;
					border-bottom-right-radius: 15rpx;
					font-size: 12px;
					text-align: center;
					color: #ffffff;
				    background-color: rgba(0, 0, 0, 0.7);
				}
			}
			.box_titleT{
				display: -webkit-box;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
				overflow: hidden;
				text-overflow: ellipsis;
				font-size: 16px;
				margin-top: 10px;
				text-align: center;
			}
		}
	}
</style>
